home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / database / powerbase / docs / Indices < prev    next >
Encoding:
Text File  |  1997-02-21  |  3.9 KB  |  69 lines

  1.                       CH 7 − USING EXTRA INDICES
  2.                       ==========================
  3. The record data is stored in a file called Database inside the database’s
  4. application directory. The order of records within Database is determined
  5. purely by the order in which the records are entered. To access the records
  6. in a logical order we need one or more indices. Powerbase has no sorting
  7. facilities other than the ability to sort a validation table or, under
  8. certain circumstances, a report.  All data ordering is achieved by the use
  9. of indices.
  10.  
  11. The most important index is index 0. This is always called “PrimaryKey” and
  12. is created as part of the process of setting up a database (see 4.5). You
  13. will find the file PrimaryKey inside the database directory. Other,
  14. subsidiary, indices are stored in the database’s Indices directory* and all
  15. have an icon bearing an “I”. When a database is opened any indices in this
  16. directory will be loaded automatically. (Indices operate in memory − to
  17. achieve maximum speed − not from disc.) Changes to the database update the
  18. indices and closing the database (or quitting Powerbase itself) causes the
  19. updated indices to be written back to the disc.
  20.  
  21. Note that the more indices you use the longer it takes to add and delete
  22. records or to make alterations to records which involve changing indices.
  23. The ideal situation is to have all fields indexed and, given a fast enough
  24. machine, a hard disc and a record structure with not very many fields, this
  25. may be feasible. Remember that fields which are repetitive − those which
  26. have only a few distinct values repeated throughout many records − do not
  27. index efficiently.
  28.  
  29. 7.1  Indexing a field
  30. =====================
  31. Click MENU over the required field and choose Index field choice from the
  32. Field submenu. The Key structure window will appear with the tag of the
  33. field you clicked on in the first Key field(s) icon. You may use the “bump”
  34. icons or pop-up menus to bring the tags of the other fields into view if you
  35. wish to base the index on more than one field. Enter the data in exactly the
  36. same way as when creating the primary key index (see 4.5) and click on
  37. Create. If the field is already indexed you will be warned of this and asked
  38. if you wish to overwrite the existing index. When indexing is complete you
  39. will see that the descriptor of the indexed field has changed from black to
  40. dark blue.
  41.  
  42. Clicking on the “key” buttons on the keypad (Shift F4 and Shift F5) causes
  43. the red highlighting which indicates the current key to move from one
  44. indexed field to another. When you have a subsidiary key selected as the
  45. current key it works just like the primary key as regards browsing,
  46. searching and printing.
  47.  
  48. There is nothing to stop you indexing one field whilst an index based on
  49. another field is the currently-active one, thus producing what amount to a
  50. sort within a sort.
  51.  
  52. One button which was greyed out when creating the primary key is the option
  53. switch Omit null keys. Although null primary keys aren’t allowed null
  54. subsidiary keys are and the default setting for this switch is therefore
  55. “off”.  The field being indexed might in some cases be null most of the time
  56. and you want to index only the records in which it isn’t.  If so, select the
  57. switch before clicking Create.
  58.  
  59. 7.2  Automatic saving of indices
  60. ================================
  61. Indices are written to disc when you close a database or quit Powerbase but,
  62. as long as the database remains open, they are in memory and therefore could
  63. be lost if the power failed or someone switched off your computer.
  64. Occasional use of the keypad’s Force update button ensures that the disc
  65. copy of all indices is more or less up-to-date but you can automate the
  66. process if you wish. Choose Preferences from the icon-bar menu, make the
  67. appropriate selection from the Save indices section of the Preferences
  68. window and click on Accept. You may make Powerbase save the indices at
  69. regular intervals or simply warn you to do so.